<template>
	<view class="m-time-line">
		<view class="m-time-line-item" v-for="(item,index) in tableData"
			:key="$m.utils.isEmpty(KeyName) ? index : item[KeyName]">
			<view class="m-time-line-item-tail" v-if="index !=tableData.length - 1"
				:style="{borderLeft: '1px solid ' + roundLineColor }"></view>
			<view class="m-time-line-item-head" :style="{color:roundColor,borderColor:roundColor}"></view>
			<view class="m-time-line-item-content">
				<slot name="content" :row="item"></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "m-time-line",
		props: {
			tableData: {
				type: Array,
				default: () => {
					let data = [];
					return data;
				}
			},
			KeyName: {
				type: String,
				default: ''
			},
			// 左侧圆环颜色
			roundColor: {
				type: String,
				default: '#02b980'
			},
			// 左侧圆环连接线颜色
			roundLineColor: {
				type: String,
				default: '#f0f0f0'
			}
		},
		data() {
			return {

			};
		}
	}
</script>

<style lang="scss">
	.m-time-line {
		box-sizing: border-box;
		color: rgba(0, 0, 0, .85);
		font-size: 12px;
		font-variant: tabular-nums;
		line-height: 1.5715;
		font-feature-settings: "tnum", "tnum";
		margin: 0;
		padding: 0;
		list-style: none;
		margin-top: 10px;
		padding: 17px 15px;
	}

	.m-time-line-item {
		position: relative;
		margin: 0;
		padding-bottom: 10px;
		font-size: 12px;
		list-style: none;
	}

	.m-time-line-item-tail {
		position: absolute;
		top: 10px;
		// top: 50%;
		// transform: translateY(10px);
		left: 4px;
		height: calc(100% - 10px);
		// height: 100%;
		// border-left: 2px solid #f0f0f0;
	}

	.m-time-line-item-head {
		position: absolute;
		// top: 50%;
		// transform: translateY(10px);
		width: 10px;
		height: 10px;
		background-color: #fff;
		border: 2px solid transparent;
		border-radius: 100px;
	}

	.m-time-line-item-head-blue {
		color: #02b980;
		border-color: #02b980;
	}

	.m-time-line-item-content {
		position: relative;
		top: -20.858px;
		// top: -10px;
		margin: 0 0 0 10px;
		word-break: break-word;
		padding-bottom: 10px;
		border-bottom: 1px solid #f7f7f7;
	}
</style>